<template>
	<view>
		<u-navbar title="" :titleStyle="{color:'#fff'}" bgColor="#3478F5" placeholder>
			<view class="u-nav-slot" slot="left">
				<u-icon name="arrow-left" size="19" color="#3478F5"></u-icon>
			</view>
		</u-navbar>
		<u-sticky >
			<view class="headbgc">
				<view class="flexleft" @click="jumpurl('/pages/login/login')" v-if="!is_login">
					<image src="@/static/image/system/weidenglu.png"
						class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="titletext bai_text bold">未登录，去登陆！</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexleft" @click="jumpurl('/pages/mine/gerenxx')" v-if="is_login">
					<image :src="userinfo.avatar_text"
						class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="flexcolumnbet" style="height: 100rpx;">
							<view class="titletext bai_text bold">{{userinfo.nickname}}</view>
							<view class="xiaobai" style="color: #DFDFDF;">账号：{{userinfo.account}}</view>
						</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexbetween topcontent margin_top6"  @click="jumpurl('/pages/mine/wodeye')" v-if="is_login">
					<view class="bai_text main_size" style="color: #efefef;">我的余额</view>
					<view class="flexright">
						<view class="titletext bai_text bold margin_right">{{userinfo.money}}</view>
						<u-icon name="arrow-right" size="14" color="#fff"></u-icon>
					</view>
				</view>
			</view>
		</u-sticky>
		<view class="mainpadding">
			<view class="ffffff radius" style="border-radius: 16rpx; padding: 40rpx 30rpx;">
				<view class="flexbetween pdl" @click="sijirz()">
					<view class="flexleft">
						<u-icon name="account" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">司机认证</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 pdl" @click="jumpurl('/pages/mine/yijianfk')">
					<view class="flexleft">
						<u-icon name="file-text" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">意见反馈</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="flexbetween margin_top4 " :class="is_login?'pdl':''" @click="phone(systeminfo.gs_tel)">
					<view class="flexleft">
						<u-icon name="server-fill" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">联系客服</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween" @click="modal.modalShow=true" v-if="is_login">
					<view class="flexleft">
						<u-icon name="info-circle" size="19" color="#3478F5"></u-icon>
						<view class="titletext hei_text bold margin_left">退出登录</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
			</view>
		</view>
		<moDal :message="modal" @modalSure="modalSure" @modalcancel="modalcancel"></moDal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userinfo:{},
				is_login: false, //是否登录
				systeminfo:{},
				modal:{
					modalShow:false,
					title:"是否确认退出登录？",
				}
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			}
			this.system()//系统配置
		},
		methods: {
			init() {
				httpRequest.request('/api/user/index', 'GET', {}, false, false, true).then(res => {
					this.userinfo = res.data
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			system(){//系统配置
				httpRequest.request('/api/index/getConfigInfo','GET',{}).then(res => {
					this.systeminfo = res.data
				})
			},
			modalSure(){
				if(this.modal.title=="是否确认退出登录？"){
					uni.removeStorageSync('token');
					uni.removeStorageSync('user_id');
					httpRequest.toast("退出登录成功")
					setTimeout(()=>{
						uni.redirectTo({
							
							url:"/pages/login/login"
						})
					},1000)
				}
				this.modalcancel()
			},
			modalcancel(){
				this.modal.modalShow = false
			},
			phone(p) {
				uni.makePhoneCall({
					phoneNumber: p.toString()
				}).catch((e) => {
				})
			},
			jumpurl(url){
				if (!httpRequest.checkIsLogin()) {
					uni.reLaunch({
						url:"/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url
				})
			},
			sijirz(){
				// 审核中走这
				if(this.userinfo.shopapply){
					uni.navigateTo({
						url:"/pages/mine/shenhe"
					})
				}else{
					uni.navigateTo({
						url:"/pages/mine/sijirz"
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.headbgc {
		background: linear-gradient(180deg, #3478F5 0%, #5088fe 100%);
		padding: 30rpx 30rpx 40rpx;

	}
	.topcontent{
		padding: 30rpx 40rpx;
		background: rgba(255,255,255,0.2);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		border: 1rpx solid rgba(255,255,255,0.6);
	}
	.myline{
		width: 1rpx;
		height: 40rpx;
		background-color: rgba(255,255,255,0.4);
	}
	.myicon{
		width: 38rpx;
		height: 38rpx;
		min-width: 38rpx;
	}
	.pdl{
		padding-bottom: 40rpx
	}
</style>
